Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
ml-regression-polynomial
Advanced tools
Polynomial Regression.
$ npm i ml-regression-polynomial
import { PolynomialRegression } from 'ml-regression-polynomial';
const x = [50, 50, 50, 70, 70, 70, 80, 80, 80, 90, 90, 90, 100, 100, 100];
const y = [
3.3, 2.8, 2.9, 2.3, 2.6, 2.1, 2.5, 2.9, 2.4, 3.0, 3.1, 2.8, 3.3, 3.5, 3.0,
];
const degree = 5; // setup the maximum degree of the polynomial
const regression = new PolynomialRegression(x, y, degree);
console.log(regression.predict(80)); // Apply the model to some x value. Prints 2.6.
console.log(regression.coefficients); // Prints the coefficients in increasing order of power (from 0 to degree).
console.log(regression.toString(3)); // Prints a human-readable version of the function.
console.log(regression.toLaTeX());
console.log(regression.score(x, y));
An interceptAtZero
option is available, to force $f(0) = 0$. Also, a "powers array" can be specified.
interceptAtZero
const regression = new PolynomialRegression(x, y, degree, {
interceptAtZero: true,
});
const powers = [0, 1, 2, 3, 4, 5];
const regression = new PolynomialRegression(x, y, powers);
powers
could also be [1,2,3,4,5]
or[1,3,5]
and so on.
For intercepting at zero using an array, skip the zero in the array (the option interceptAtZero
is ignored in this case.)
FAQs
Polynomial Regression
The npm package ml-regression-polynomial receives a total of 11,557 weekly downloads. As such, ml-regression-polynomial popularity was classified as popular.
We found that ml-regression-polynomial demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.